package Others.DesignPattern.FactoryPattern.Pattern;

import Others.DesignPattern.FactoryPattern.Pattern.Object.LeiFeng;
import Others.DesignPattern.FactoryPattern.Pattern.Object.UndergraduateFactory;
import Others.DesignPattern.FactoryPattern.Pattern.Object.VolunteerFactory;

public class main {
    public static void main(String[] args) {

        //如果我们要创建一个大学生对象我们只需要--创建一个对应的对象工厂即可
        //若是修改--也仅仅只需要修改工厂代码一行即可
        //而且是真正意义上也做到了开闭原则--缺点就是每增加一个对象，就要为其创建对应的工厂类
        UndergraduateFactory undergraduateFactory = new UndergraduateFactory();
        LeiFeng UndergraduateA = undergraduateFactory.createLeiFeng();
        LeiFeng UndergraduateB = undergraduateFactory.createLeiFeng();
        LeiFeng UndergraduateC = undergraduateFactory.createLeiFeng();

        UndergraduateA.Wash();
        UndergraduateB.Sweep();
        UndergraduateC.BuyRice();

        VolunteerFactory volunteerFactory = new VolunteerFactory();
        LeiFeng volunteerA = volunteerFactory.createLeiFeng();
        LeiFeng volunteerB = volunteerFactory.createLeiFeng();
        LeiFeng volunteerC = volunteerFactory.createLeiFeng();

        volunteerA.Wash();
        volunteerB.Sweep();
        volunteerC.BuyRice();


        //进一步提升方向--结合反射内容
    }
}
